<template>
  <div>
    <button @click="isShow = !isShow">显示/隐藏</button>
    <transition>
      <h1 v-show="isShow">你好啊</h1>
    </transition>
  </div>
</template>

<script>
  export default {
    name:'App',
    data() {
      return {
        isShow:true
      }
    },
  }
</script>

<style>
  h1 {
    background-image: linear-gradient(45deg,red,yellow,green);
    transition: 1s linear;
  }
  /* 离开的起点,来的终点 */
  .v-leave,.v-enter-to{
    transform: translateX(0);
  }
  /* 离开的终点，来的起点 */
  .v-leave-to,.v-enter{
    transform: translateX(-100%);
  }
</style>